package com.thomasmoerman.dci2.tmc

import com.thomasmoerman.dci2.frw.Context

trait TransferMoneyContextFactory {
  this: MoneySourceProvider with MoneySinkProvider =>
  
  class TransferMoneyContext(
    val sourceAccountId: Long, 
    var destinationAccountId: Long, 
    var amount: Double) extends Context {
    
    def execute {
      val source = getMoneySource(sourceAccountId)
      
      val destination = getMoneySink(destinationAccountId)
      
      source.transferMoney(destination, amount)
    }
    
  }
  
}